this._minimizing = [];
this._unminimizing = [];
this._mapping = [];
+ this._resizing = [];
this._destroying = [];
this._movingWindow = null;
this._minimizeWindowDone(shellwm, actor);
this._mapWindowDone(shellwm, actor);
this._destroyWindowDone(shellwm, actor);
+ this._sizeChangeWindowDone(shellwm, actor);
}));
this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
},
_sizeChangeWindow : function(shellwm, actor, whichChange, oldFrameRect, oldBufferRect) {
+ let types = [Meta.WindowType.NORMAL];
+ if (!this._shouldAnimateActor(actor, types)) {
+ shellwm.completed_size_change(actor);
+ return;
+ }
+
+ if (whichChange == Meta.SizeChange.FULLSCREEN)
+ this._fullscreenWindow(shellwm, actor, oldFrameRect, oldBufferRect);
+ else if (whichChange == Meta.SizeChange.UNFULLSCREEN)
+ this._unfullscreenWindow(shellwm, actor, oldFrameRect, oldBufferRect);
+ else
+ shellwm.completed_size_change(actor);
+ },
+
+ _fullscreenWindow: function(shellwm, actor, oldFrameRect, oldBufferRect) {
+ actor.translation_x = oldFrameRect.x;
+ actor.translation_y = oldFrameRect.y;
+ this._fullscreenAnimation(shellwm, actor, oldFrameRect);
+ },
+
+ _unfullscreenWindow: function(shellwm, actor, oldFrameRect, oldBufferRect) {
+ let targetRect = actor.meta_window.get_frame_rect();
+ actor.translation_x = -targetRect.x;
+ actor.translation_y = -targetRect.y;
+ this._fullscreenAnimation(shellwm, actor, oldFrameRect);
+ },
+
+ _fullscreenAnimation: function(shellwm, actor, oldFrameRect) {
+ this._resizing.push(actor);
+
+ // Position a clone of the window on top of the old position,
+ // while actor updates are frozen.
+ // Note that the MetaWindow has up to date sizing information for
+ // the new geometry already.
+ let targetRect = actor.meta_window.get_frame_rect();
+ let actorContent = Shell.util_get_content_for_window_actor(actor, oldFrameRect);
+ let actorClone = new St.Widget({ content: actorContent });
+ actorClone.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
+ actorClone.set_position(oldFrameRect.x, oldFrameRect.y);
+ actorClone.set_size(oldFrameRect.width, oldFrameRect.height);
+ Main.uiGroup.add_actor(actorClone);
+
+ actor.__fullscreenClone = actorClone;
+
+ let scaleX = targetRect.width / oldFrameRect.width;
+ let scaleY = targetRect.height / oldFrameRect.height;
+
+ // Now scale and fade out the clone
+ Tweener.addTween(actorClone,
+ { x: targetRect.x,
+ y: targetRect.y,
+ scale_x: scaleX,
+ scale_y: scaleY,
+ opacity: 0,
+ time: WINDOW_ANIMATION_TIME,
+ transition: 'easeOutQuad'
+ });
+
+ // Now set scale the actor to size it as the clone.
+ // Note that the caller of this function already set a translation
+ // on the actor.
+ actor.scale_x = 1 / scaleX;
+ actor.scale_y = 1 / scaleY;
+
+ // Scale it to its actual new size
+ Tweener.addTween(actor,
+ { scale_x: 1.0,
+ scale_y: 1.0,
+ translation_x: 0,
+ translation_y: 0,
+ time: WINDOW_ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: this._sizeChangeWindowDone,
+ onCompleteScope: this,
+ onCompleteParams: [shellwm, actor]
+ });
+
+ // Now unfreeze actor updates, to get it to the new size.
+ // It's important that we don't wait until the animation is completed to
+ // do this, otherwise our scale will be applied to the old texture size.
shellwm.completed_size_change(actor);
},
+ _sizeChangeWindowDone: function(shellwm, actor) {
+ if (this._removeEffect(this._resizing, actor)) {
+ Tweener.removeTweens(actor);
+ actor.scale_x = 1.0;
+ actor.scale_y = 1.0;
+ actor.translation_x = 0;
+ actor.translation_y = 0;
+
+ let actorClone = actor.__fullscreenClone;
+ if (actorClone) {
+ actorClone.destroy();
+ delete actor.__fullscreenClone;
+ }
+ }
+ },
+
_hasAttachedDialogs: function(window, ignoreWindow) {
var count = 0;
window.foreach_transient(function(win) {
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
+#include <meta/meta-shaped-texture.h>
#include <locale.h>
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
clutter_actor_event (actor, &event, FALSE);
}
+
+static gboolean
+canvas_draw_cb (ClutterContent *content,
+ cairo_t *cr,
+ gint width,
+ gint height,
+ gpointer user_data)
+{
+ cairo_surface_t *surface = user_data;
+
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_paint (cr);
+
+ return FALSE;
+}
+
+/**
+ * shell_util_get_content_for_window_actor:
+ * @window_actor: a #MetaWindowActor
+ * @window_rect: a #MetaRectangle
+ *
+ * Returns: (transfer full): a new #ClutterContent
+ */
+ClutterContent *
+shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
+ MetaRectangle *window_rect)
+{
+ ClutterActor *texture;
+ ClutterContent *content;
+ cairo_surface_t *surface;
+ cairo_rectangle_int_t clip;
+ gfloat actor_x, actor_y;
+
+ texture = meta_window_actor_get_texture (window_actor);
+ clutter_actor_get_position (CLUTTER_ACTOR (window_actor), &actor_x, &actor_y);
+
+ clip.x = window_rect->x - (gint) actor_x;
+ clip.y = window_rect->y - (gint) actor_y;
+ clip.width = window_rect->width;
+ clip.height = window_rect->height;
+
+ surface = meta_shaped_texture_get_image (META_SHAPED_TEXTURE (texture),
+ &clip);
+
+ content = clutter_canvas_new ();
+ clutter_canvas_set_size (CLUTTER_CANVAS (content),
+ clip.width, clip.height);
+ g_signal_connect (content, "draw",
+ G_CALLBACK (canvas_draw_cb), surface);
+ clutter_content_invalidate (content);
+ cairo_surface_destroy (surface);
+
+ return content;
+}